/* Definitions for C++ parsing and type checking.
   Copyright (C) 1987 Free Software Foundation, Inc.
   Hacked by Michael Tiemann (tiemann@mcc.com)

This file is part of GNU CC.

GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.  No author or distributor
accepts responsibility to anyone for the consequences of using it
or for whether it serves any particular purpose or works at all,
unless he says so in writing.  Refer to the GNU CC General Public
License for full details.

Everyone is granted permission to copy, modify and redistribute
GNU CC, but only under the conditions described in the
GNU CC General Public License.   A copy of this license is
supposed to have been given to you along with GNU CC so you
can know your rights and responsibilities.  It should be in a
file named COPYING.  Among other things, the copyright notice
and this notice must be preserved on all copies.  */

/* Borrow everything that is C from c-tree.h  */
#include "c-tree.h"

enum languages { lang_c, lang_cplusplus };

/* Macros to make error reporting functions' lives easier.  */
#define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (NODE))))
#define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (DECL_NAME (TYPE_NAME (NODE))))

/* Virtual function addresses can be gotten from a virtual function
   table entry using this macro.  */
#define FNADDR_FROM_VTABLE_ENTRY(ENTRY) \
  TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY))))

/* Statistics show that while the GNU C++ compiler may generate
   thousands of different types during a compilation run, it
   generates relatively few (tens) of classtypes.  Because of this,
   it is not costly to store a generous amount of information
   in classtype nodes.  */
struct lang_type
{
  /* This must fill out to a multiple of 4 bytes.  */
  struct
    {
      unsigned has_type_conversion_attr : 1;
      unsigned has_int_conversion_attr : 1;
      unsigned has_float_conversion_attr : 1;
      unsigned gets_init_ref_attr : 1;
      unsigned gets_new_attr : 1;
      unsigned gets_delete_attr : 1;
      unsigned has_assignment_attr : 1;
      unsigned gets_assignment_attr : 1;

      unsigned has_assign_ref_attr : 1;
      unsigned gets_assign_ref_attr : 1;
      unsigned has_wrapper : 1;
      unsigned needs_wrapper : 1;
      unsigned has_wrapper_pred : 1;
      unsigned has_method_call_overloaded : 1;
      unsigned gets_init_aggr_attr : 1;
      unsigned has_call_overloaded : 1;

      unsigned has_array_ref_overloaded : 1;
      unsigned any_assigns_this : 1;
      unsigned none_assign_this : 1;
      unsigned uses_multiple_inheritance : 1;
      unsigned marked : 1;
      unsigned marked2 : 1;
      unsigned marked3 : 1;
      unsigned marked4 : 1;

      unsigned marked5 : 1;
      unsigned virtual_attr : 1;
      unsigned needs_constructor_attr : 1;
      unsigned declared_class : 1;
      unsigned private_attr : 1;
      unsigned const_needs_init : 1;
      unsigned ref_needs_init : 1;
      unsigned uses_virtual_base_classes : 1;

#ifdef SOS
      unsigned dynamic : 1;
#else
      unsigned : 1;
#endif
      unsigned has_uninheritable_virtuals : 1;
      unsigned alters_visibilities : 1;
      unsigned dummy2 : 13;
    } type_flags;

  short n_parents;
  int vsize;
  union tree_node *fn_fields;
  union tree_node *offset;
  union tree_node *vtable, *virtuals;
  union tree_node *vfield;
  union tree_node *vbases;
  union tree_node *full_size;

  int cid;
  union tree_node **types;
  int n_ancestors;
  void *search_slot;

  union tree_node *tags;
  union tree_node *main_class_variant;
  union tree_node *this_class_variant;
  union tree_node *next_class_variant;
  void *memoized_table_entry;

  unsigned char *via_pub_or_virt;

  enum machine_mode mode : 8;
  unsigned char size_unit;
  unsigned char align;
  unsigned char sep_unit;

  union tree_node *sep;
  union tree_node *size;

  union tree_node *base_init_list;
  union tree_node *uninherited_virtuals;
  union tree_node *as_list;

  char *mi_matrix;
  int unused1;
  int unused2;
  int unused3;

#ifdef SOS
  union tree_node *typename_as_string;
  union tree_node *dynamic_filename;
  union tree_node *dynamic_table;
#endif
};

/* Nonzero for _CLASSTYPE means that the _CLASSTYPE either has
   a special meaning for the assignment operator ("operator="),
   or one of its fields (or base members) has a special meaning
   defined.  */
#define TREE_HAS_ASSIGNMENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_assignment_attr)
#define TREE_GETS_ASSIGNMENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_assignment_attr)

/* Nonzero for _CLASSTYPE means that operator new and delete are defined,
   respectively.  */
#define TREE_GETS_NEW(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_new_attr)
#define TREE_GETS_DELETE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_delete_attr)

/* Nonzero for TREE_LIST or _CLASSTYPE node means that the path to the
   base class is via a `public' declaration, which preserves public
   fields from the base class as public.
   OVERLOADED.  */
#define TREE_VIA_PUBLIC(NODE) ((NODE)->common.external_attr)

/* Nonzero for TREE_LIST node means that the path to the
   base class is via a `protected' declaration, which preserves
   protected fields from the base class as protected.
   OVERLOADED.  */
#define TREE_VIA_PROTECTED(NODE) ((NODE)->common.public_attr)

/* Nonzero for a _CLASSTYPE node which we know to be private.  */
#define TYPE_PRIVATE_P(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.private_attr)

/* Nonzero for a _CLASSTYPE node means that the derivation chain is via
   a `virtual' declaration. OVERLOADED.  */
#define TREE_VIA_VIRTUAL(NODE) ((NODE)->common.public_attr)

/* Nonzero means that this _CLASSTYPE node defines ways of converting
   itself to other types.  */
#define TYPE_HAS_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_type_conversion_attr)

/* Nonzero means that this _CLASSTYPE node can convert itself to an
   INTEGER_TYPE.  */
#define TYPE_HAS_INT_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_int_conversion_attr)

/* Nonzero means that this _CLASSTYPE node can convert itself to an
   REAL_TYPE.  */
#define TYPE_HAS_REAL_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_float_conversion_attr)

/* Nonzero means that this _CLASSTYPE node overloads operator=(X&).  */
#define TYPE_HAS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_assign_ref_attr)
#define TYPE_GETS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_assign_ref_attr)

/* Nonzero means that this _CLASSTYPE node has an X(X&) constructor.  */
#define TYPE_GETS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_init_ref_attr)

/* Nonzero means that this _CLASSTYPE node has an X(X ...) constructor.
   Note that there must be other arguments, or this constructor is flaged
   as being erroneous.  */
#define TYPE_GETS_INIT_AGGR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_init_aggr_attr)

/* Nonzero means that this _CLASSTYPE node overloads the method call
   operator.  In this case, all method calls go through `operator->()(...).  */
#define TYPE_OVERLOADS_METHOD_CALL_EXPR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_method_call_overloaded)
#define TYPE_HAS_WRAPPER(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_wrapper)
#define TYPE_NEEDS_WRAPPER(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.needs_wrapper)
#define TYPE_HAS_WRAPPER_PRED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_wrapper_pred)

/* Nonzero means that this _CLASSTYPE node overloads operator().  */
#define TYPE_OVERLOADS_CALL_EXPR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_call_overloaded)

/* Nonzero means that this _CLASSTYPE node overloads operator[].  */
#define TYPE_OVERLOADS_ARRAY_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_array_ref_overloaded)

/* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
   multiple inheritance.  If this is 0 for the root of a type
   hierarchy, then we can use more efficient search techniques.  */
#define TYPE_USES_MULTIPLE_INHERITANCE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.uses_multiple_inheritance)

/* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
   virtual base classes.  If this is 0 for the root of a type
   hierarchy, then we can use more efficient search techniques.  */
#define TYPE_USES_VIRTUAL_BASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.uses_virtual_base_classes)

/* List of lists of member functions defined in this class.  */
#define CLASSTYPE_FN_FIELDS(NODE) (TYPE_LANG_SPECIFIC(NODE)->fn_fields)

/* Nonzero if the Nth baseclass of this class is via `public'.  */
#define CLASSTYPE_VIA_PUBLIC(NODE, N) (TYPE_LANG_SPECIFIC(NODE)->via_pub_or_virt[N]&1)
/* Nonzero if the Nth baseclass of this class is via `virtual'.  */
#define CLASSTYPE_VIA_VIRTUAL(NODE, N) ((TYPE_LANG_SPECIFIC(NODE)->via_pub_or_virt[N]&2)>>1)

/* Accessor macros for the above two constructs.  */
#define CLASSTYPE_VIAS(NODE) (TYPE_LANG_SPECIFIC(NODE)->via_pub_or_virt)
#define SET_CLASSTYPE_VIAS(NODE, N, PUB, VIRT) (TYPE_LANG_SPECIFIC(NODE)->via_pub_or_virt[N] = (PUB|(VIRT<<1)))

/* Mark bits for depth-first and breath-first searches.  */
#define CLASSTYPE_MARKED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked)
#define CLASSTYPE_MARKED2(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked2)
#define CLASSTYPE_MARKED3(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked3)
#define CLASSTYPE_MARKED4(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked4)
#define CLASSTYPE_MARKED5(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked5)

/* When building a matrix to determine by a single lookup
   whether one class is derived from another or not,
   this field is the index of the class in the table.  */
#define CLASSTYPE_CID(NODE) (TYPE_LANG_SPECIFIC(NODE)->cid)

#define CLASSTYPE_TAGS(NODE) (TYPE_LANG_SPECIFIC(NODE)->tags)
#define CLASSTYPE_NAMES(NODE) (TYPE_LANG_SPECIFIC(NODE)->names)

/* When a class becomes a non-leftmost baseclass in a multiple
   inheritance hierarchy, the number of bytes that subobjects
   of this type are offset from the begining of the containing record.
   This is an INTEGER_CST which holds the value of
   DECL_OFFSET (TYPE_NAME (NODE)).

   Note that for virtual base classes, the offset is only meaningful
   for the construction and initialization of virtual baseclass pointers
   and virtual function table entries.  Otherwise, the offset of a
   virtual baseclass is irrelevant, since it is accessed through a
   pointer, and not via a delta.  */
#define CLASSTYPE_OFFSET(NODE) (TYPE_LANG_SPECIFIC (NODE)->offset)

/* The virtual function table which belongs to this class.  If this
   class is a non-leftmost baseclass in a multiple inheritance
   hierarchy, then the virtual function table will be different
   than the one for the CLASSTYPE_MAIN_VARIANT type.  */
#define CLASSTYPE_VTABLE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vtable)
/* The virtual function table pointer field.  */
#define CLASSTYPE_VFIELD(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfield)
/* The list of functions in the virtual function table
   for this _CLASSTYPE node.  */
#define CLASSTYPE_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC(NODE)->virtuals)
/* The number of virtual functions defined for this
   _CLASSTYPE node.  */
#define CLASSTYPE_VSIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vsize)
/* The virtual base classes that this type uses.  */
#define CLASSTYPE_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbases)

/* Number of baseclasses defined for this type.
   0 means no base classes.  */
#define CLASSTYPE_N_BASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->n_parents)
/* Vector of base classes for this type.  This vector is
   indexed starting at 1.  */
#define CLASSTYPE_BASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->types)
/* Accessor macro for the Nth baseclass of type NODE.  */
#define CLASSTYPE_THIS_BASECLASS(NODE, N) (TYPE_LANG_SPECIFIC(NODE)->types[N])
/* Accessor macro for the Nth baseclass of type NODE.  */
#define CLASSTYPE_BASECLASS(NODE, N) (CLASSTYPE_THIS_VARIANT (TYPE_LANG_SPECIFIC(NODE)->types[N]))

/* Memoize the number of super classes (base classes) tha this node
   has.  That way we can know immediately (albeit conservatively how
   large a multiple-inheritance matrix we need to build to find
   derivation information.  */
#define CLASSTYPE_N_SUPERCLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->n_ancestors)

/* Used for keeping search-specific information.  Any search routine
   which uses this must define what exactly this slot is used for.  */
#define CLASSTYPE_SEARCH_SLOT(NODE) (TYPE_LANG_SPECIFIC(NODE)->search_slot)

/* The canonical form of this base class.  It also happens to be
   TYPE_MAIN_VARIANT.  */
#define CLASSTYPE_MAIN_VARIANT(NODE) (TYPE_LANG_SPECIFIC(NODE)->main_class_variant)
/* The form of this base class--needed because we may make
   copies of this node for virtual function table purposes.
   If this node is not a virtual baseclass and its offset is
   integer_zero_node, it is the value of NODE.  */
#define CLASSTYPE_THIS_VARIANT(NODE) (TYPE_LANG_SPECIFIC(NODE)->this_class_variant)
/* For baseclasses with non-zero valued offsets, a chain of
   such versions of this baseclass.  */
#define CLASSTYPE_NEXT_VARIANT(NODE) (TYPE_LANG_SPECIFIC(NODE)->next_class_variant)

/* Entry for keeping memoization tables for this type to
   hopefully speed up search routines.  Since it is a pointer,
   it can mean almost anything.  */
#define CLASSTYPE_MTABLE_ENTRY(NODE) (TYPE_LANG_SPECIFIC(NODE)->memoized_table_entry)

/* This is the total size of the baseclasses defined for this type.
   Needed because it is desirable to layout such information
   before begining to process the class itself, and we
   don't want to compute it second time when actually laying
   out the type for real.  */
#define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->size)
#define CLASSTYPE_SIZE_UNIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->size_unit)
#define CLASSTYPE_MODE(NODE) (TYPE_LANG_SPECIFIC(NODE)->mode)
#define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->align)

/* This includes the space needed for virtual base classes.  */
#define CLASSTYPE_FULL_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->size)

/* A cons list of structure elements which either have constructors
   to be called, or virtual function table pointers which
   need initializing.  Depending on what is being initialized,
   the TREE_PURPOSE and TREE_VALUE fields have different meanings:

   Member initialization: <FIELD_DECL, TYPE>
   Base class construction: <NULL_TREE, BASETYPE>
   Base class initialization: <BASE_INITIALIZAION, THESE_INITIALIZATIONS>
   Whole type: <MEMBER_INIT, BASE_INIT>.  */
#define CLASSTYPE_BASE_INIT_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->base_init_list)

/* A cons list of virtual functions which cannot be inherited by
   derived classes.  When deriving from this type, the derived
   class must provide its own definition for each of these functions.  */
#define CLASSTYPE_UNINHERITED_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC(NODE)->uninherited_virtuals)

#define CLASSTYPE_HAS_UNINHERITABLE_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_uninheritable_virtuals)

#define CLASSTYPE_ALTERS_VISIBILITIES_P(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.alters_visibilities)

/* Many routines need to cons up a list of basetypes for visibility
   checking.  This field contains a TREE_LIST node whose TREE_VALUE
   is the main variant of the type, and whose TREE_VIA_PUBLIC
   and TREE_VIA_VIRTUAL bits are correctly set.  */
#define CLASSTYPE_AS_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->as_list)

/* Keep an inheritance lattice around so we can quickly tell whether
   a type is derived from another or not.  */
#define CLASSTYPE_MI_MATRIX(NODE) (TYPE_LANG_SPECIFIC(NODE)->mi_matrix)

#ifdef SOS
/* Nonzero means that class is "dynamic" in SOS sense.  (IRIA-specific.)  */
#define TYPE_DYNAMIC(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.dynamic)

/* The name of this type as a STRING.  */
#define CLASSTYPE_TYPENAME_AS_STRING(NODE) (TYPE_LANG_SPECIFIC(NODE)->typename_as_string)
/* The name of the file which defines this type.  */
#define CLASSTYPE_DYNAMIC_FILENAME(NODE) (TYPE_LANG_SPECIFIC(NODE)->dynamic_filename)
/* The table of all member functions, linearized.  */
#define CLASSTYPE_DYNAMIC_TABLE(NODE) (TYPE_LANG_SPECIFIC(NODE)->dynamic_table)
#endif

/* Say whether this node was declared as a "class" or a "struct".  */
#define CLASSTYPE_DECLARED_CLASS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.declared_class)

/* Nonzero if this class has const members which have no specified initialization.  */
#define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.const_needs_init)

/* Nonzero if this class has ref members which have no specified initialization.  */
#define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.ref_needs_init)

/* Nonzero for TREE_LIST node means that this list of things
   is a list of parameters, as opposed to a list of expressions.  */
#define TREE_PARMLIST(NODE) ((NODE)->common.regdecl_attr) /* overloaded! */

/* Nonzero for FIELD_DECL node means that this FIELD_DECL is
   a member of an anonymous union construct.  The name of the
   union is .  */
#define TREE_ANON_UNION_ELEM(NODE) ((NODE)->common.regdecl_attr) /* overloaded! */

struct lang_decl
{
  struct
    {
      enum languages language : 8;

      unsigned this_private_attr : 1;
      unsigned this_protected_attr : 1;
      unsigned this_public_attr : 1;
      unsigned operator_attr : 1;
      unsigned overloaded_attr : 1;
      unsigned is_constructor : 1;
      unsigned returns_first_arg_attr : 1;
      unsigned preserves_first_arg : 1;

      unsigned in_aggr_attr : 1;
      unsigned is_friend_attr : 1;
      unsigned is_static_function_attr : 1;
      unsigned is_const_memfunc_attr : 1;
      unsigned is_volatile_memfunc_attr : 1;
      unsigned dummy11 : 11;
    } decl_flags;
  tree original_name;
  tree visibility;
  tree vindex;
  tree vcontext;
#ifdef SOS
  tree dynamic_index;
#endif
  tree main_decl_variant;
  struct pending_inline *pending_inline_info;
};

/* For FUNCTION_DECLs: return the language in which this decl
   was declared.  */
#define DECL_LANGUAGE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.language)

/* For FUNCTION_DECLs: nonzero means that this function is a constructor.  */
#define DECL_CONSTRUCTOR_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.is_constructor)

/* For FUNCTION_DECLS: nonzero means that the constructor
   is known to return a non-zero `this' unchanged.  */
#define DECL_RETURNS_FIRST_ARG(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.returns_first_arg_attr)

/* Nonzero for FUNCTION_DECL means that this constructor is known to
   not make any assignment to `this', and therefore can be trusted
   to return it unchanged.  Otherwise, we must re-assign `current_class_decl'
   after performing base initializations.  */
#define DECL_PRESERVES_THIS(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.preserves_first_arg)

/* Nonzero for _DECL means that this decl appears in (or will appear in)
   as a member in a RECORD_TYPE or UNION_TYPE node.  This is for detecting
   circularity in case members are multiply defined.  */
#define DECL_IN_AGGR_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.in_aggr_attr)

/* Nonzero for FUNCTION_DECL means that this decl is just a
   friend declaration, and should not be added to the list of
   member functions for this class.  */
#define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.is_friend_attr)

/* Nonzero for FUNCTION_DECL means that this decl is a static
   member function.  */
#define DECL_STATIC_FUNCTION_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.is_static_function_attr)

/* Nonzero for FUNCTION_DECL means that this member function
   has `this' as const X *const.  */
#define DECL_CONST_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.is_const_memfunc_attr)

/* Nonzero for FUNCTION_DECL means that this member function
   has `this' as volatile X *const.  */
#define DECL_VOLATILE_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.is_volatile_memfunc_attr)

/* Nonzero for FIELD_DECL node means that this FIELD_DECL is
   a member of an anonymous union construct.  */
#define DECL_ANON_UNION_ELEM(NODE) ((NODE)->common.regdecl_attr) /* overloaded! */

/* For a FUNCTION_DECL: the name of the function before being overloaded.  */
#define DECL_ORIGINAL_NAME(NODE) (DECL_LANG_SPECIFIC(NODE)->original_name)

/* Points back to the decl which caused this lang_decl to be allocated.  */
#define DECL_MAIN_VARIANT(NODE) (DECL_LANG_SPECIFIC(NODE)->main_decl_variant)

/* For a FUNCTION_DECL: if this function was declared inline inside of
   a class declaration, this is where the text for the function is
   squirreled away.  */
#define DECL_PENDING_INLINE_INFO(NODE) (DECL_LANG_SPECIFIC(NODE)->pending_inline_info)
   
/* Nonzero in INT_CST means that this int is negative by dint of
   using a twos-complement negated operand.  */
#define TREE_NEGATED_INT(NODE) (TREE_LANG_FLAG_1 (NODE))

/* Nonzero in IDENTIFIER_NODE and FUNCTION_DECL means that
   this name is overloaded, and should be looked up
   in a non-standard way.  */
#define TREE_OVERLOADED(NODE) (TREE_LANG_FLAG_1 (NODE))

/* Nonzero if this IDENTIFIER_NODE has meaning as a class
   instance variable or member function.  */
#define TREE_CLASS_VALUE(NODE) (TREE_LANG_FLAG_2 (NODE))

/* Nonzero if this (non-TYPE)_DECL has its virtual attribute set.
   For a FUNCTION_DECL, this is when the function is a virtual function.
   For a VAR_DECL, this is when the variable is a virtual function table.
   For a FIELD_DECL, when the field is the field for the virtual function table.  */
#define DECL_VIRTUAL_P(NODE) (TREE_LANG_FLAG_2 (NODE))

/* Nonzero for FIELD_DECLs means that this field is private,
   and can only be accessed within the scope of the class
   which defines it (or its friends).  */
#define TREE_PRIVATE(NODE) (TREE_LANG_FLAG_3 (NODE))
/* Same, but tells if this field is private in current context.  */
#define TREE_FIELD_PRIVATE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.this_private_attr)

/* Nonzero for FIELD_DECLs means that this field is protected,
   and can only be accessed within the scope of the class
   which defines it, its friends, or if there is a path in
   the type hierarchy from the current class scope to
   the one that defines it. */
#define TREE_PROTECTED(NODE) (TREE_LANG_FLAG_4 (NODE))
/* Same, but tells if this field is private in current context.  */
#define TREE_FIELD_PROTECTED(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.this_protected_attr)

#define TREE_FIELD_PUBLIC(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.this_public_attr)

/* Nonzero for _TYPE means that the _TYPE defines
   at least one constructor.  */
#define TYPE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_1(NODE))

/* When appearing in an INDIRECT_REF, it means that the tree structure
   underneath is actually a call to a constructor.  This is needed
   when the constructor must initialize local storage (which can
   be automatically destroyed), rather than allowing it to allocate
   space from the heap.  */
#define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_1(NODE))

/* Nonzero for _TYPE means that the _TYPE defines a destructor.
   This implicitly means that a constructor is also defined.  */
#define TYPE_HAS_DESTRUCTOR(NODE) (TREE_LANG_FLAG_2(NODE))

/* Nonzero for _TYPE node means that creating an object of this type
   will involve a call to a constructor.  This can apply to objects
   of ARRAY_TYPE if the type of the elements needs a constructor.  */
#define TYPE_NEEDS_CONSTRUCTING(NODE) (TREE_LANG_FLAG_3(NODE))
#define TYPE_NEEDS_CONSTRUCTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.needs_constructor_attr)

/* Nonzero for _TYPE node means that destroying an object of this type
   will involve a call to a destructor.  This can apply to objects
   of ARRAY_TYPE is the type of the elements needs a destructor.  */
#define TYPE_NEEDS_DESTRUCTOR(NODE) (TREE_LANG_FLAG_4(NODE))

/* Nonzero in FIELD_DECL means that the underlying FUNCTION_DECL
   is really an operator.  */
#define TREE_OPERATOR(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.operator_attr)

/* Nonzero for FIELD_DECLs and _TYPEs means that the argument
   is virtual.  For a FIELD_DECL, this means that while a direct
   function call can be made in certain cases, this function
   must generally be accessed via a virtual function table.
   For _TYPEs, it means that this type defines or uses a
   virtual function table for some of its methods.  */
#define TYPE_VIRTUAL_P(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.virtual_attr)

/* May be useful for optimization using strictness analysis.
   TREE_ANY_ASSIGNS_THIS nonzero means that there is one constructor
   within the hierarchy of TYPE which is known to assign to `this'.

   TREE_NONE_ASSIGNS_THIS nonzero means that it is known that
   no constructor within the hierarchy of TYPE makes an assignment
   to `this'.

   Both of these can be zero, in which case it just means that we don't
   have sufficient information yet.  They cannot, however, both be nonzero.  */
#define TREE_ANY_ASSIGNS_THIS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.any_assigns_this)
#define TREE_NONE_ASSIGN_THIS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.none_assign_this)

/* Define fields and accessors for nodes representing declared names.  */

/* C++: A derived class may be able to directly use the virtual
   function table of a base class.  When it does so, it may
   still have a decl node used to access the virtual function
   table (so that variables of this type can initialize their
   virtual function table pointers by name).  When such thievery
   is commited, know exactly which base class's virtual function
   table is the one being stolen.  This effectively computes the
   transitive closure.  */
#define DECL_VPARENT(NODE) ((NODE)->decl.arguments)

/* C++: all of these are overloaded!  These apply only to TYPE_DECLs.  */
#define DECL_FRIENDLIST(NODE) ((NODE)->decl.voffset)
#define DECL_UNDEFINED_FRIENDS(NODE) ((NODE)->decl.context)
#define DECL_WAITING_FRIENDS(NODE) ((tree)(NODE)->decl.rtl)
#define SET_DECL_WAITING_FRIENDS(NODE,VALUE) ((NODE)->decl.rtl=(struct rtx_def*)VALUE)
#define DECL_FRIEND_CLASSES(NODE) ((NODE)->decl.result)
#define DECL_THIS_PTR(NODE) ((tree)(NODE)->decl.frame_size)
#define SET_DECL_THIS_PTR(NODE,VALUE) ((NODE)->decl.frame_size=(int)VALUE)
#define DECL_VTBL_PTR(NODE) ((tree)(NODE)->decl.saved_insns)
#define SET_DECL_VTBL_PTR(NODE,VALUE) ((NODE)->decl.saved_insns=(struct rtx_def*)VALUE)

/* C++: all of these are overloaded! These apply only to FIELD_DECLs.  */
#define DECL_STATIC_NAME(NODE) ((tree)(NODE)->decl.offset)
#define SET_DECL_STATIC_NAME(NODE,VAL) ((NODE)->decl.offset = (int)VAL)

/* The DECL_VISIBILITY is used to record under which context
   special visibility rules apply.  */
#define DECL_VISIBILITY(NODE) (DECL_LANG_SPECIFIC(NODE)->visibility)

/* The DECL_VINDEX is used for FIELD_DECLS in two different ways.
   Before the struct containing the FIELD_DECL is laid out,
   DECL_VINDEX may point to a FIELD_DECL in a base class which
   is the FIELD_DECL which this FIELD_DECL will replace as a virtual
   function.  When the class is laid out, this pointer is changed
   to an INT_CST node which is suitable for use as an index
   into the virtual function table.  */
#define DECL_VINDEX(NODE) (DECL_LANG_SPECIFIC(NODE)->vindex)
#define SET_DECL_VINDEX(NODE,VAL) (DECL_LANG_SPECIFIC(NODE)->vindex = VAL)

/* DECL_VCONTEXT is the *first* baseclass in which this FUNCTION_DECL
   (or FIELD_DECL) is defined.  Contrast this with DECL_CONTEXT (or
   DECL_FIELD_CONTEXT), which is the *last* such baseclass.  */
#define DECL_VCONTEXT(NODE) (DECL_LANG_SPECIFIC(NODE)->vcontext)

/* For static member functions, which can never be virtual,
   we need to know to what class the method belongs.  This
   is where we stash the information.  */
#define DECL_STATIC_CONTEXT(NODE) (DECL_LANG_SPECIFIC(NODE)->vcontext)

/* Pointer from any member function to the head of the list of
   member functions of the type that member function belongs to.  */
#define TREE_BASELINK(NODE) (TREE_TYPE(NODE))

/* C++: all of these are overloaded!  These apply to PARM_DECLs and VAR_DECLs.  */
#define DECL_REFERENCE_SLOT(NODE) ((tree)(NODE)->decl.frame_size)
#define SET_DECL_REFERENCE_SLOT(NODE,VAL) ((NODE)->decl.frame_size=(int)VAL)

#ifdef SOS
#define DECL_DINDEX(NODE) (DECL_LANG_SPECIFIC(NODE)->dynamic_index)
#endif

/* An enumeration of the kind of tags that C++ accepts.  */
enum tag_types { record_type, class_type, union_type, enum_type };

/* Zero means prototype weakly, as in ANSI C (no args means nothing).
   Each language context defines how this variable should be set.  */
extern int strict_prototype;
extern int strict_prototypes_lang_c, strict_prototypes_lang_cplusplus;

/* Non-zero means that if a label exists, and no other identifier
   applies, use the value of the label.  */
extern int flag_labels_ok;

/* Non-zero means to collect statistics which might be expensive
   and to print them when we are done.  */
extern int flag_detailed_statistics;

/* Non-zero means warn in function declared in derived class has the
   same name as a virtual in the base class, but fails to match the
   type signature of any virtual function in the base class.  */
extern int warn_overloaded_virtual;

/* in cplus-decl.c */
extern tree build_member_type ();

extern tree vtable_entry_type;
extern tree build_vtable_entry ();
extern tree build_vfn_ref ();
extern tree finish_table ();

extern tree lookup_some_tag ();
extern tree identifier_class_value ();

extern int complete_array_type ();

/* A node that is a list (length 1) of error_mark_nodes.  */
extern tree error_mark_list;

extern tree ptr_type_node;
extern tree class_type_node, record_type_node, union_type_node, enum_type_node;
extern tree unknown_type_node;

extern tree get_temp_name (), get_temp_aggr (), get_temp_regvar ();
extern tree build_classfn_ref ();
extern tree build_type_conversion ();
extern tree maybe_convert_decl_to_const ();
extern char *lang_printable_name ();

/* The largest size a virtual function table can be.
   Must be a (power of 2).  */

#define VINDEX_MAX ((unsigned)128)
/* This is the integer ~ (vindex_max - 1).  */
extern tree vtbl_mask;

/* Array type `(void *)[]' */
extern tree vtbl_type_node;

extern tree get_parm_types ();
extern tree grokopexpr (), getaggrs (), groktypefield (), grok_enum_decls ();
extern void finish_anon_union();
extern tree long_long_integer_type_node, long_long_unsigned_type_node;
extern tree get_first_matching_virtual ();

/* in cplus-typeck.c */
extern tree build_x_conditional_expr ();
extern tree build_x_unary_op (), build_x_binary_op ();
extern tree build_x_function_call ();
extern tree build_x_indirect_ref (), build_x_array_ref ();
extern tree build_x_modify_expr (), build_x_modify_op_expr ();

extern tree build_m_component_ref ();
extern tree build_component_type_expr ();
extern tree build_x_arrow ();
extern tree build_component_ref_1 ();
extern tree datatype (), unary_complex_lvalue ();
extern tree build_return_stmt ();
extern tree actualparameterlist ();
extern tree cplus_size_in_bytes ();
extern tree cplus_sizeof (), cplus_sizeof_nowarn ();

extern tree error_mark_list;

/* in tree.c */
extern tree build_let ();
extern tree build_classtype_variant ();

/* in cplus-class.c */
extern tree current_class_name;
extern tree current_class_type;
extern tree prev_class_type;

extern tree current_lang_name, lang_name_cplusplus, lang_name_c;

extern tree hack_identifier (), hack_operator (), hack_wrapper ();
extern tree convert_to_nonzero_pointer (), convert_to_reference (), convert_to_aggr (), convert_aggr ();
extern tree build_x_new (), build_x_delete ();
extern tree build_new (), build_vec_new (), build_delete (), build_vec_delete ();
extern tree make_destructor_name ();
extern tree build_scoped_ref (), build_method_call (), build_vfield_ref ();
extern tree build_type_pathname ();
extern tree do_actual_overload ();
extern tree start_method (), start_type_method ();
extern tree finish_method ();

extern tree lookup_field (), lookup_fnfields ();

void pushclass (), popclass (), pushclasstype ();
extern tree build_operator_fnname (), build_opfncall (), build_type_conversion ();
extern tree build_wrapper ();

/* Points to the name of that function. May not be the DECL_NAME
   of CURRENT_FUNCTION_DECL due to overloading */
extern tree original_function_name;

# define IS_AGGR_TYPE(t) \
  (TREE_CODE (t) == RECORD_TYPE || TREE_CODE (t) == UNION_TYPE)

# define IS_AGGR_TYPE_CODE(t) \
  (t == RECORD_TYPE || t == UNION_TYPE)

extern tree build_decl_overload (), build_typename_overload ();
extern tree build_destructor_call ();
extern tree current_class_name, current_class_type, current_class_decl, C_C_D;
extern tree current_vtable_decl;

/* in cplus-init.c  */
extern tree resolve_member_ref ();
extern tree purpose_member (), value_member ();
extern void check_base_init ();
extern void do_member_init ();
extern tree global_base_init_list;
extern tree current_base_init_list, current_member_init_list;
#ifdef SOS
extern tree get_linktable_name (), get_dtable_name (), get_sos_dtable ();
#endif
extern tree get_member_function ();
extern tree build_member_call (), build_member_ref ();

extern int current_function_assigns_this;
extern int current_function_just_assigned_this;
extern int current_function_parms_stored;

/* Cannot use '$' up front, because this confuses gdb.
   Note that any format of this kind *must* make the
   format for `this' lexicgraphically less than any other
   parameter name, i.e. "$this" is less than anything else can be.

   Note that all forms in which the '$' is significant are long enough
   for direct indexing.  */

#define THIS_NAME "$this"
#define VPTR_NAME "$vptr"
#define DESTRUCTOR_NAME_FORMAT "~%s"
#define DESTRUCTOR_DECL_FORMAT "_$_%s"
#define WRAPPER_NAME_FORMAT "()%s"
#define WRAPPER_DECL_FORMAT "__W$%s"
#define WRAPPER_PRED_NAME_FORMAT "()?%s"
#define WRAPPER_PRED_DECL_FORMAT "__P$%s"
#define ANTI_WRAPPER_NAME_FORMAT "~()%s"
#define ANTI_WRAPPER_DECL_FORMAT "__w$%s"
#define AUTO_DELETE_NAME "__delete$me__"
#define AUTO_VTABLE_NAME "__vtbl$me__"
#define AUTO_TEMP_NAME "_$tmp_"
#define AUTO_TEMP_FORMAT "_$tmp_%d"
#define OPERATOR_ASSIGN_FORMAT "op$assign_%s"
#define OPERATOR_FORMAT "op$%s"
#define VTABLE_NAME_FORMAT "_vt$%s"
#define VFIELD_NAME "_vptr$"
#define VFIELD_NAME_FORMAT "_vptr$%s"
#define VBASE_NAME "_vb$"
#define VBASE_NAME_FORMAT "_vb$%s"
#define STATIC_NAME_FORMAT "_%s$%s"
#define OPERATOR_TYPENAME_FORMAT "type$"
#define FILE_FUNCTION_FORMAT "_GLOBAL_$D$%s"
#define FILE_FUNCTION_PREFIX_LEN 9
#define VTABLE_DELTA_NAME "delta"
#define VTABLE_DELTA2_NAME "delta2"
#define VTABLE_INDEX_NAME "index"
#define VTABLE_PFN_NAME "pfn"

#define THIS_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '$' \
			      && IDENTIFIER_POINTER (ID_NODE)[1] == 't')
#define VPTR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '$' \
			      && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')
#define DESTRUCTOR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == '$')

#define WRAPPER_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
				 && IDENTIFIER_POINTER (ID_NODE)[2] == 'W' \
				 && IDENTIFIER_POINTER (ID_NODE)[3] == '$')
#define WRAPPER_PRED_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
				 && IDENTIFIER_POINTER (ID_NODE)[2] == 'P' \
				 && IDENTIFIER_POINTER (ID_NODE)[3] == '$')
#define ANTI_WRAPPER_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
				      && IDENTIFIER_POINTER (ID_NODE)[2] == 'w' \
				      && IDENTIFIER_POINTER (ID_NODE)[3] == '$')
#define WRAPPER_OR_ANTI_WRAPPER_NAME_P(ID_NODE) \
  (IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
   && (IDENTIFIER_POINTER (ID_NODE)[2]|('W'^'w')) == 'w' \
   && IDENTIFIER_POINTER (ID_NODE)[3] == '$')

#define OPERATOR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[2] == '$' \
  && IDENTIFIER_POINTER (ID_NODE)[1])

#define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[3] == '$' \
  && IDENTIFIER_POINTER (ID_NODE)[2] == 't'\
  && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')

#define VBASE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[3] == '$' \
  && IDENTIFIER_POINTER (ID_NODE)[2] == 'b'\
  && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')

#define OPERATOR_TYPENAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[4] == '$' \
  && IDENTIFIER_POINTER (ID_NODE)[3] \
  && IDENTIFIER_POINTER (ID_NODE)[2] \
  && IDENTIFIER_POINTER (ID_NODE)[1])

#define TEMP_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1))
#define VFIELD_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1))

/* For anonymous aggregate types, we need some sort of name to
   hold on to.  In practice, this should not appear, but it should
   not be harmful if it does.  */
#define ANON_AGGRNAME_FORMAT "$_%d"
#define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '$')

#define ANON_PARMNAME_FORMAT "_%d"
#define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
				  && IDENTIFIER_POINTER (ID_NODE)[1] <= '9')

enum visibility_type {
  visibility_default,
  visibility_public,
  visibility_private,
  visibility_protected,
  visibility_default_virtual,
  visibility_public_virtual,
  visibility_private_virtual,
};

enum visibility_type compute_visibility ();

/* in cplus-lex.c  */
extern char *operator_name_string ();

/* Things for handling inline functions.  */

struct pending_inline
{
  struct pending_inline *next;	/* pointer to next in chain */
  int lineno;			/* line number we got the text from */
  char *filename;		/* name of file we were processing */
  tree fndecl;			/* FUNCTION_DECL that brought us here */
  int token;			/* token we were scanning */
  int token_value;		/* value of token we were scanning (YYSTYPE) */

  char *buf;			/* pointer to character stream */
  int len;			/* length of stream */
};

extern tree combine_strings ();
extern int yylex ();

/* in cplus-method.c */
extern tree wrapper_name, wrapper_pred_name, anti_wrapper_name;
extern struct pending_inline *pending_inlines;
extern char *print_fndecl_with_types ();

/* 1 for -fall-virtual: make every member function (except
   constructors) lay down in the virtual function table.
   Calls can then either go through the virtual function table or not,
   depending on whether we know what function will actually be called.

   2 for -fSOS: make every member function (including constructors)
   lay down in the virtual function table.  All calls go through the
   virtual function table: this takes the place of using a linker.  */

extern int flag_all_virtual;

/* Nonzero to make characters constants have the data type `char'.
   This data type is signed or unsigned depending on flag_signed_char.  */

extern int flag_char_charconst;

/* Nonzero means that we cannot make optimizing assumptions about `this'.  */

extern int flag_this_is_variable;

enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG, WRAPPER_FLAG, WRAPPER_PRED_FLAG, ANTI_WRAPPER_FLAG };

extern tree default_conversion (), pushdecl (), pushdecl_top_level ();
extern tree make_instance_name (), do_decl_overload ();
extern tree maybe_build_cleanup ();
extern tree build_instantiated_decl (), instantiate_type ();
extern tree build_vtbl_ref ();
extern tree make_anon_parm_name ();
extern int resolves_to_fixed_type_p ();

extern tree do_friend ();
extern void grokclassfn ();

extern tree current_class_decl, C_C_D;	/* PARM_DECL: the class instance variable */

/* The following two can be derived from the previous one */
extern tree current_class_name;	/* IDENTIFIER_NODE: name of current class */
extern tree current_class_type;	/* _TYPE: the type of the current class */

/* The following structure is used when comparing various alternatives
   for overloading.  The unsigned quantity `strikes.i' is used
   for fast comparison of two possibilities.  This number is an
   aggregate of four constituents:

     EVIL: if this is non-zero, then the candidate should not be considered
     USER: if this is non-zero, then a user-defined type conversion is needed
     B_OR_D: if this is non-zero, then use a base pointer instead of the
             type of the pointer we started with.
     EASY: if this is non-zero, then we have a builtin conversion
           (such as int to long, int to float, etc) to do.

   If two candidates require user-defined type conversions, and the
   type conversions are not identical, then an ambiguity error
   is reported.

   If two candidates agree on user-defined type conversions,
   and one uses pointers of strictly higher type (derived where
   another uses base), then that alternative is silently chosen.

   If two candidates have a non-monotonic derived/base pointer
   relationship, and/or a non-monotonic easy conversion relationship,
   then a warning is emitted to show which paths are possible, and
   which one is being chosen.

   For example:

   int i;
   double x;

   overload f;
   int f (int, int);
   double f (double, double);

   f (i, x);	// draws a warning

   struct B
   {
     f (int);
   } *bb;
   struct D : B
   {
     f (double);
   } *dd;

   dd->f (x);	// exact match
   dd->f (i);	// draws warning

   Note that this technique really only works for 255 arguments.  Perhaps
   this is not enough.  */

struct candidate
{
  tree function;		/* A FUNCTION_DECL */

  unsigned char evil;		/* ~0 if this will never convert.  */
  unsigned char user;		/* ~0 if at least one user-defined type conv.  */
  unsigned short b_or_d;	/* count number of derived->base conv.  */
  unsigned short easy;		/* count number of builtin type conv.  */
  tree arg;			/* an _EXPR node that is first parm to function */
  unsigned short *harshness;	/* Indexed by argument number, encodes
				   evil, user, b_or_d, and easy strikes for
				   that argument.
				   At end of array, we store the index+1 where we
				   started using default parameters, or 0
				   if there are none.  */
  union
    {
      tree field;		/* If no evil strikes, the FIELD_DECL of
				   the function (if a member function).  */
      int bad_arg;		/* the index of the first bad argument:
				   0 if no bad arguements
				   > 0 is first bad argument
				   -1 if extra actual arguments
				   -2 if too few actual arguments.  */
    } u;
};
int rank_for_overload ();
struct candidate *ideal_candidate ();
/* Some macros for char-based bitfields.  */
#define B_SET(a,x) (a[x>>3] |= (1 << (x&7)))
#define B_CLR(a,x) (a[x>>3] &= ~(1 << (x&7)))
#define B_TST(a,x) (a[x>>3] & (1 << (x&7)))

/* These are uses as bits in flags passed to build_method_call
   to control its error reporting behavior.

   LOOKUP_PROTECT means flag visibility violations.
   LOOKUP_COMPLAIN mean complain if no suitable member function
     matching the arguments is found.
   LOOKUP_NORMAL is just a combination of these two.
   LOOKUP_AGGR requires the instance to be of aggregate type.
   LOOKUP_NONVIRTUAL means make a direct call to the member function found
   LOOKUP_GLOBAL means search through the space of overloaded functions,
     rather than the space of member functions.
   LOOKUP_DYNAMIC means call dynamic functions, a la SOS.  */

#define LOOKUP_PROTECT (1)
#define LOOKUP_COMPLAIN (2)
#define LOOKUP_NORMAL (3)
#define LOOKUP_AGGR (4)
#define LOOKUP_NONVIRTUAL (8)
#define LOOKUP_GLOBAL (16)
#define LOOKUP_DYNAMIC (32)
#define LOOKUP_SPECULATIVELY (64)
#define LOOKUP_PROTECTED_OK (128)

/* Anatomy of a DECL_FRIENDLIST (which is a TREE_LIST):
   purpose = friend name (IDENTIFIER_NODE);
   value = TREE_LIST of FUNCTION_DECLS;
   chain, type = EMPTY;  */
#define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST))
#define FRIEND_DECLS(LIST) (TREE_VALUE (LIST))

extern tree get_temp_name (), get_temp_aggr (), get_temp_regvar ();
extern tree build_method_call ();
extern tree build_type_conversion ();
extern tree decl_constant_value ();

/* in cplus-init.c */
extern tree resolve_offset_ref ();
extern tree build_with_cleanup ();

/* in cplus-lex.c  */
extern char *operator_name_string ();

extern int base_type_p ();
extern tree get_base_type ();
extern int get_base_type_index_bfs ();
extern int get_base_type_index_dfs ();
extern tree build_op_identifier ();

/* Indexed by TREE_CODE, these tables give C-looking names to
   operators represented by TREE_CODES.  For example,
   opname_tab[(int) MINUS_EXPR] == "-".  */
extern char *opname_tab[], *assignop_tab[];

extern tree build_lang_decl ();
extern tree make_lang_type ();
extern tree cons_up_dtor_for_type ();

/* in cplus-convert.c  */
extern tree convert_from_reference ();

/* in cplus-search.c  */
extern tree init_vbase_pointers ();
extern tree build_vbase_pointer ();
extern tree lookup_fnfield ();

extern tree get_base_type ();
extern tree get_vbase_types ();
extern tree get_baselinks ();
extern tree get_wrapper ();

/* in stor-layout.c  */
extern tree layout_basetypes ();
extern tree layout_addtl_vbasetype ();

#define PRINT_LANG_DECL
#define PRINT_LANG_TYPE

/* -- end of C++ */

#define UNKNOWN_TYPE LANG_TYPE

#define NO_AUTO_OVERLOAD
